From eda2fc42d9e6cd0f1216bff62433718f682e0bb2 Mon Sep 17 00:00:00 2001 From: Bond-009 Date: Tue, 24 Sep 2019 21:38:54 +0200 Subject: Fix clang8.0 build (#4399) The protocol 13.0 PR broke clang 8.0 builds. --- src/Protocol/Protocol_1_13.cpp | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/src/Protocol/Protocol_1_13.cpp b/src/Protocol/Protocol_1_13.cpp index 87a7ff6da..f84e8d1bd 100644 --- a/src/Protocol/Protocol_1_13.cpp +++ b/src/Protocol/Protocol_1_13.cpp @@ -32,10 +32,12 @@ Implements the 1.13 protocol classes: #define HANDLE_READ(ByteBuf, Proc, Type, Var) \ Type Var; \ - if (!ByteBuf.Proc(Var))\ - {\ - return;\ - } + do { \ + if (!ByteBuf.Proc(Var))\ + {\ + return;\ + } \ + } while (false) @@ -43,14 +45,16 @@ Implements the 1.13 protocol classes: #define HANDLE_PACKET_READ(ByteBuf, Proc, Type, Var) \ Type Var; \ - { \ - if (!ByteBuf.Proc(Var)) \ + do { \ { \ + if (!ByteBuf.Proc(Var)) \ + { \ + ByteBuf.CheckValid(); \ + return false; \ + } \ ByteBuf.CheckValid(); \ - return false; \ } \ - ByteBuf.CheckValid(); \ - } + } while (false) -- cgit v1.2.3